package com.aliyun.oss.mapper;

import com.aliyun.oss.pojo.Entity.Orders;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface ReportMapper extends BaseMapper<Orders> {
    @Select("SELECT od.name, SUM(od.number) AS total_amount FROM orders, order_detail od WHERE orders.id =od.order_id and orders.order_time >= #{startTime} AND orders.order_time <= #{endTime} and orders.status=5 GROUP BY od.name ORDER BY total_amount DESC LIMIT 10")
    List<Map<String, Object>> getSelesTop10(LocalDateTime startTime, LocalDateTime endTime);
}
